/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chl.cid.jsfproducts.controllerbeans;

import edu.chl.cid.jsfproducts.Product;
import edu.chl.cid.jsfproducts.ProductJpaCtrl;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;

/**
 *
 * @author Mikey
 */
@ManagedBean
public class AddProductControllerBean {

    @EJB
    private ProductJpaCtrl productJpaCtrl;
    
    private Product product = new Product();
    
    /** Creates a new instance of AddProductControllerBean */
    public AddProductControllerBean() {
    }
    
    public String addProduct(){
        System.out.println("Addproduct anrooped! "+product.getName()+", "+product.getCat()+", "+product.getPrice());
        product = productJpaCtrl.create(product);
        return "onAddProduct";
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    
    
}
